<template>
  <div class="summary-item">
    <div
      class="title"
      v-if="type === 'week'"
    >
      <b>{{ data.weekStartDate | timeDate('YYYY-MM-DD') }}~{{ data.weekEndDate | timeDate('YYYY-MM-DD') }}</b>
      <span>{{ data.planningWeek }}</span>
    </div>
    <div
      class="title"
      v-else-if="type === 'month'"
    >
      <b>{{ data.year }}</b>
    </div>
    <div
      class="title"
      v-else
    >
      <b>{{ data.year }}</b>
    </div>
    <div
      class="info"
    >
      <div class="text">
        <div class="item">
          总共生产<span>{{ data.beamProductionQuantity }}</span>片梁
        </div>
        <div class="item">
          边梁<span>{{ data.SideBeam }}</span>片 中梁<span>{{ data.CenterSill }}</span>片 架梁<span>{{ data.numberOfBeamsErected }}</span>片
        </div>
      </div>
      <div
        class="opt"
        v-if="type!== 'year'"
      >
        <div
          class="show"
          @click="show"
        >
          查看梁片>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "NoticeItem",
  props: {
    type: {
      type: String,
      default: "week",
    },
    data: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    show() {
      this.$emit('show', this.data)
    }
  }
};
</script>

<style lang="scss" scoped>
.summary-item {
  padding: 15px;
  border-bottom: 10px solid #f6f6f6;
  .title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 15px;
    position: relative;
    margin-bottom: 10px;
    &::before {
      content: '';
      display: block;
      width: 4px;
      height: 100%;
      position: absolute;
      top:0;left:0;
      background: #3e83ed;
      border-radius: 2px;
    }
    b {
      font-size: 16px;
      color: #333;
    }
    span {
      font-size: 12px;
      color: #999999;
    }
  }
  .info {
    display: flex;
    .text {
      flex: 1;
      width: 0;
      .item {
        margin: 5px 0 0;
        color: #999;
        font-size: 14px;
        span {
          color: #333;
        }
      }
    }
    .opt {
      display: flex;
      flex-direction: column;
      .show {
        flex: 1;
        height: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #537fb9;
        font-size: 14px;
        text-decoration: underline;
      }
    }
  }
}
</style>
